﻿package mortal.game.view.guide.guideUse
{
    import extend.language.*;
    import flash.events.*;
    import flash.geom.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.util.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class GuideHalidomUseWin extends GuideEquipUseWin
    {

        public function GuideHalidomUseWin(param1:ILayer = null)
        {
            super(param1);
            return;
        }// end function

        override protected function updateData() : void
        {
            var _loc_1:int = 0;
            var _loc_2:* = new ItemData(_itemData.serverData);
            _txtName.htmlText = _itemData.itemInfo.htmlName;
            var _loc_3:int = 0;
            _myEquip = Cache.instance.pack.halidomBag.getEquipByType(_itemData.itemInfo.type);
            if (_myEquip != null)
            {
                _loc_3 = EquipmentUtil.getEquipCombat(_myEquip);
                _txtEquipName.htmlText = Language.getStringByParam(20999, ItemsUtil.getItemWholeName(_myEquip, true));
            }
            else
            {
                _txtEquipName.htmlText = Language.getStringByParam(20999, Language.getString(21000));
            }
            _loc_1 = EquipmentUtil.getEquipCombat(_loc_2);
            if (_myEquip != null && _loc_1 > _loc_3)
            {
                _txtAdd.text = (_loc_1 - _loc_3).toString();
                _txtDesc.text = Language.getString(21003);
            }
            else
            {
                _txtAdd.text = _loc_1.toString();
                _txtDesc.text = Language.getString(21005);
            }
            return;
        }// end function

        override protected function useItemHandler(event:MouseEvent) : void
        {
            disposeTimer();
            var _loc_2:* = _item.localToGlobal(GameConst.yellowPoint);
            FlyToNavbarTool.flyBitmapOriginalToPack(_item.bitmapdata, _loc_2, ModuleType.Players);
            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPack_HalidomEquip, _item.itemData));
            this.hide();
            return;
        }// end function

    }
}
